<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags"%>
<%@ page isELIgnored="false"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
  <head>
    <link href="<s:url value="/resources"/>/css/style_new.css" rel="stylesheet" type="text/css" />
    <link href="<s:url value="/resources"/>/css/main_new.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/cupertino/jquery-ui.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/ui.multiselect.css" />
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-ui.custom.min.js"></script> 
    <script type="text/javascript" src="<s:url value="/resources"/>/js/i18n/grid.locale-cn.js"></script>    
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.jqGrid.min.js"></script>
    <script type="text/javascript" src="<s:url value="/resources"/>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>
    
    <script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.alerts.js"></script>
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/jquery.alerts.css" />
  </head>
  
  <script type="text/javascript">  
   $(function(){ 
	    $( "#datepicker" ).datepicker($.datepicker.regional[ "zh-CN" ]);
	    $( "#datepicker1" ).datepicker($.datepicker.regional[ "zh-CN" ]);
	    queryNum();
	    queryNum1();
	    loadTab();    
  });
  
  //加载表
  function loadTab(){ 
      $("#myTab").jqGrid({      
		    url:'<s:url value="/cxtj"/>/gridJyfjn',   
		    datatype: 'json',
		    mtype: 'post',         
		   	colNames:['发货单位名称','实际缴费单位', '发站','年份','缴费金额(元)','缴费日期'],
		   	colModel:[
		      	{name:'fahdwmc',index:'fahdwmc',width:100}, 
		      	{name:'jiaofdwmc',index:'jiaofdwmc', width:200},
		   		{name:'mingch',index:'mingch', width:200},
		   		{name:'nianf',index:'nianf', width:150 },
		   		{name:'jiaofje',index:'jiaofje', width:150 },		
		   		{name:'jiaofrq',index:'jiaofrq', width:200},		
		   	],
		    jsonReader: {
		           repeatitems : false, 
		           id: 'sysid'
		         },   
		    height:300, 	
		   	rowNum:10,
		   	rowList:[10,30,50],     	
		   	pager: '#pager',
		   	rownumbers: true,   	 
		    viewrecords: true,
		    //multiselect: true, 
		    sortorder: 'desc', 
		    caption: "邀约交易费缴纳情况"
	  });
	  }
	  
	  
	//新增
	function add()
	{
	    window.location.href='<s:url value="/hptx"/>/addHptx',target='mainFrame';
	}
	
	//查看
	function display(id) { 
	    window.location.href='<s:url value="/hptx"/>/displayHptx?sysid='+ id;
	}
	
	//修改
	function verify(id) { 
      	window.location.href='<s:url value="/hptx"/>/editHptx?sysid='+ id;
	}
	
	//删除
	function remove() {	
		var sysid = $("#myTab").jqGrid('getGridParam','selarrrow');
		alert(sysid);
		if (sysid.length == 0)
		{
		    jAlert('请至少选择一条记录','提示');
		}
		else
		{
		var url = "<s:url value="/hptx"/>/removeHptx?sysid="+sysid;
		$( "#dialog-confirm" ).dialog({
				resizable: false,
				height:140,
				modal: true,
				buttons: {
					"确认": function() {
						$.post(url, function(data) {
							var obj = eval('(' + data + ')');
							if(obj.success==true){
							        location.href ="<s:url value="/hptx"/>/findHptxlist";
							 }else{
							         alert(obj.msg);
							       }
	                   });
	                   $( this ).dialog( "close" ); 
					},
					"返回": function() {
						$( this ).dialog( "close" );
					}
				}
			});
		}
	}
	
  
	// 查询
	function search(){ 
	  var formdata = $("#form1").serialize(); 
	  $("#myTab").jqGrid('setGridParam',{   
	                          url:'<s:url value="/cxtj"/>/gridJyfjn?'+formdata,
							  mtype:'post',
							  page:1}).trigger("reloadGrid");  
	}
	
	//导出
	function exportexcel(){ 
	  var formdata = $("#form1").serialize(); 
	  window.location.href("<s:url value="/hptx"/>/excelHptx?"+formdata);
	}
	
	
	//计算成交金额函数
	function queryNum(){   
		  var formdata = $("#form1").serialize(); 
		  $.post("<s:url value="/cxtj"/>/tongjiJyfjn",formdata,function(data,textStatus)
			  {
			   var json = eval('(' + data + ')');
			   $("#queryNum").html("应缴："+(json[0].yingjiao/10000).toFixed(4)+"万元、已缴："+(json[0].yijiao/10000).toFixed(4)+"万元、未缴："+((json[0].yingjiao/10000).toFixed(4)-(json[0].yijiao/10000).toFixed(4))+"万元");
              });
       }
       
       //计算成交金额函数1
	function queryNum1(){
	      var formdata = $("#form1").serialize();   
		  $.post("<s:url value="/cxtj"/>/tongjiJyfjn1",formdata,function(data,textStatus)
			  {
			   var json = eval('(' + data + ')');
			   //alert(json[0].zongji);
			   $("#queryNum1").html("合计金额："+(json[0].zongji/10000).toFixed(4)+"万元");
              });
       }

</script>  
<body>  
<div class="container">
 <div class="containerbox">
  <%-- <div class="btn-bar"> 
    <a id="xinz" href="#" class="btn" onclick= "add();"><img src="<s:url value="/resources"/>/img/ico_23.gif" /><span>新增</span></a> 
    <a id="shanc" href="#" class="btn" onclick="remove();"><img src="<s:url value="/resources"/>/img/ico_25.gif" /><span>删除</span></a>
    <a id="excel" href="#" class="btn" onclick="exportexcel();"><img src="<s:url value="/resources"/>/img/25.gif" /> <span>导出excel</span></a>
   </div> --%>
 <div class="search mt10" id="list_search">
<form id="form1" method="post">
<table class="search-table"  style="width:90%"  cellpadding="0" cellspacing="0" border="0"> 
        <tr>
            <td>
            	实际缴费单位:
            </td>
            <td>
            	<input type="text" class="form-textbox" style="width: 200px;" name="aa" /> 
            </td>
            <td class="pr10 search-table-70">
                                               年份:
            </td>
            <td>
				<select name="bb" class="form-textbox" style="width: 200px;">
					<option value="2014" >2014</option>
					<option value="2015"  selected>2015</option>
					<option value="2016" >2016</option>
				</select>
            </td>            
        </tr>
        <tr>
            <td>
                 <input  type="button" class="form-button-query form-button" value="查询" onclick="queryNum1();search();"/>
                 <input  type="reset" class="form-button-reset form-button" value="重置" />
            </td>
        </tr>
  </table>
  </form>
    </div>
    <div class="btn-bar">
       <ul>
            <li id="queryNum" style="float:middle; vertical-align: bottom; line-height:33px; "></li>
	   </ul>
	</div>   
	<div class="btn-bar">
	   <ul>
            <li id="queryNum1" style="float:middle; vertical-align: bottom; line-height:33px; "></li>
	   </ul>
    </div>
    <table id="myTab" class="scroll" cellpadding="0" cellspacing="0"></table>  
   <div id="pager" class="scroll"></div>  
   <div id="message" class="scroll"></div> 
</div> 
</div>
<div id="dialog-confirm" title="是否确认删除？"></div>
</body>
</html>
